package com.example.moshudriver.protocol;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.external.activeandroid.DataBaseModel;
import com.external.activeandroid.annotation.Column;
import com.external.activeandroid.annotation.Table;

@Table(name = "userapply_serviceRequest")
public class userapply_serviceRequest  extends DataBaseModel
{

     @Column(name = "uid")
     public int uid;

     @Column(name = "sid")
     public String   sid;

     @Column(name = "firstclass_service_category_id")
     public int firstclass_service_category_id;

     @Column(name = "ver")
     public int ver;

     @Column(name = "secondclass_service_category_id")
     public int secondclass_service_category_id;

     @Column(name = "service_type_id")
     public int service_type_id;

     public void  fromJson(JSONObject jsonObject)  throws JSONException
     {
          if(null == jsonObject){
            return ;
           }

          JSONArray subItemArray;

          this.uid = jsonObject.optInt("uid");

          this.sid = jsonObject.optString("sid");

          this.firstclass_service_category_id = jsonObject.optInt("firstclass_service_category_id");

          this.ver = jsonObject.optInt("ver");

          this.secondclass_service_category_id = jsonObject.optInt("secondclass_service_category_id");

          this.service_type_id = jsonObject.optInt("service_type_id");
          return ;
     }

     public JSONObject  toJson() throws JSONException 
     {
          JSONObject localItemObject = new JSONObject();
          JSONArray itemJSONArray = new JSONArray();
          localItemObject.put("uid", uid);
          localItemObject.put("sid", sid);
          localItemObject.put("firstclass_service_category_id", firstclass_service_category_id);
          localItemObject.put("ver", ver);
          localItemObject.put("secondclass_service_category_id", secondclass_service_category_id);
          localItemObject.put("service_type_id", service_type_id);
          return localItemObject;
     }

}
